|
1
|
|
|
/** |
|
2
|
|
|
* Theme Customizer enhancements for a better user experience. |
|
3
|
|
|
* |
|
4
|
|
|
* This is the JS that runs on the site in the preview window |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
( function( $ ) { |
|
8
|
|
|
|
|
9
|
|
|
// Update the site title in real time... |
|
10
|
|
|
wp.customize( 'blogname', function( value ) { |
|
|
|
|
|
|
11
|
|
|
value.bind( function( newval ) { |
|
12
|
|
|
$( 'h1.site-title a' ).html( newval ); |
|
13
|
|
|
} ); |
|
14
|
|
|
} ); |
|
15
|
|
|
|
|
16
|
|
|
//Update the site description in real time... |
|
17
|
|
|
wp.customize( 'blogdescription', function( value ) { |
|
|
|
|
|
|
18
|
|
|
value.bind( function( newval ) { |
|
19
|
|
|
$( '.site-description' ).html( newval ); |
|
20
|
|
|
} ); |
|
21
|
|
|
} ); |
|
22
|
|
|
|
|
23
|
|
|
//Update the headers layout.css |
|
24
|
|
|
wp.customize( 'lsx_header_layout', function( value ) { |
|
|
|
|
|
|
25
|
|
|
value.bind( function( newval ) { |
|
26
|
|
|
$( 'body' ).removeClass( 'header-central' ); |
|
27
|
|
|
$( 'body' ).removeClass( 'header-expanded' ); |
|
28
|
|
|
$( 'body' ).addClass( 'header-'+ newval ); |
|
29
|
|
|
} ); |
|
30
|
|
|
}); |
|
31
|
|
|
|
|
32
|
|
|
//Update the fixed header in real time... |
|
33
|
|
|
wp.customize( 'lsx_header_fixed', function( value ) { |
|
|
|
|
|
|
34
|
|
|
value.bind( function( newval ) { |
|
35
|
|
|
if ( true == newval ) { |
|
36
|
|
|
$( 'body header.navbar' ).addClass( 'navbar-static-top' ); |
|
37
|
|
|
$( 'body' ).addClass( 'top-menu-fixed'); |
|
38
|
|
|
} else { |
|
39
|
|
|
$( 'body header.navbar' ).removeClass( 'navbar-static-top' ); |
|
40
|
|
|
$( 'body' ).removeClass( 'top-menu-fixed' ); |
|
41
|
|
|
} |
|
42
|
|
|
} ); |
|
43
|
|
|
} ); |
|
44
|
|
|
|
|
45
|
|
|
//Update the fixed header in real time... |
|
46
|
|
|
wp.customize( 'lsx_header_search', function( value ) { |
|
|
|
|
|
|
47
|
|
|
value.bind( function( newval ) { |
|
48
|
|
|
|
|
49
|
|
|
if(true == newval){ |
|
50
|
|
|
$('body #searchform').show(); |
|
51
|
|
|
}else{ |
|
52
|
|
|
$('body #searchform').hide(); |
|
53
|
|
|
} |
|
54
|
|
|
} ); |
|
55
|
|
|
} ); |
|
56
|
|
|
|
|
57
|
|
|
} )( jQuery ); |
|
58
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.